# -*- coding: utf_8 -*-
# @Time : 2021/8/12 0012 15:24
# @Author : lyw
# @Remark : 门禁出入记录
import time

from pydantic import validator

from mxsoftpy import Model


class RecordModel(Model):
    start_time: str
    end_time: str
    door_id: str = ""
    door: str = "*"
    personnel: str = "*"
    pagesize: int = 10
    pageindex: int = 1

    @validator('start_time')
    def check_start_time(cls, value):
        return int(time.mktime(time.strptime(value, "%Y-%m-%d %H:%M:%S")))

    @validator('end_time')
    def check_end_time(cls, value):
        return int(time.mktime(time.strptime(value, "%Y-%m-%d %H:%M:%S")))
